{extend name="$admin_layout" /}
{block name="style"}
<style>
	#table{
		width: 100% !important;
	}
	.form-control[disabled],
	.form-control[readonly],
	fieldset[disabled] .form-control {
		background-color: #FFFFFF;
		opacity: 1;
	}
</style>
<link rel="stylesheet" href="https://cdn.datatables.net/1.11.4/css/jquery.dataTables.min.css">
<link rel="stylesheet" href="https://cdn.datatables.net/fixedcolumns/4.0.1/css/fixedColumns.dataTables.min.css">
{volist name="css_list" id="vo"}
<link rel="stylesheet" href="{$vo}?v={:config('asset_version')}">
{/volist}
{/block}
{block name="content"}

<div class="row">
	<div class="col-md-12">
		{notempty name="page_tips"}
		<div class="callout callout-{$tips_type}">
			{$page_tips|raw}
		</div>
		{/notempty}
	</div>
</div>
<div class="row">
	<div class="col-md-12">
		<div class="box">
		{notempty name="top_search"}
			<div class="box-header with-border">
				<h3 class="box-title">搜索条件</h3>
			</div>
			<!-- 独立搜索 -->
			<div class="box nav-tabs-custom" >
				<div class="box-body">
					<div class="tab-pane active">
						<div class="row">
							<form action="" method="get" id="manage_from" class="marBtm">
								<input type="hidden" value="" name="export" />
								{volist name="top_search" id="search_val"}
								{if ($search_val['type'] == 'text')}
								<div class="col-md-2 col-xs-6">
									<span class="txt">{$search_val.title}：</span>
									<input type="text" class="form-control" name="{$search_val.name}" placeholder="请输入{$search_val.title}" value="{$search_val.default}">
								</div>
								{/if}
								{if ($search_val['type'] == 'daterange')}
								<div class="col-md-2 col-xs-6">
									<span class="txt">{$search_val.title} ：</span>
									<input type="text" class="form-control js-date-range pl10" readonly style="background:#fff;cursor: pointer;" name="{$search_val.name}" placeholder="请选择{$search_val.title}" value="{$search_val.default}">
								</div>
								{/if}
								{if ($search_val['type'] == 'select')}
								<div class="col-md-2 col-xs-6">
									<span class="txt">{$search_val.title}：</span>
									<select name="{$search_val.name}" class="select2 custom-css">
										<option value="all">选择{$search_val.title}</option>
										{volist name="$search_val.param" id="select_val"}
										<option value="{$key}" {if strval($key) === strval($search_val['default'])}selected{/if}>{$select_val}</option>
										{/volist}
									</select>
								</div>
								{/if}
								{/volist}
								<div class="col-md-2 col-xs-6" style="padding-top: 18px;">
									<button class="btn btn-primary btn-flat"  onclick="btn_out_search()" type="button">搜索</button>
									{if $excel_show == 1}
									<button class="btn btn-success btn-flat" onclick="btn_out()" type="button">{:lang('导出')}</button>
									{/if}
									<button class="btn btn-default btn-flat" type="button" onclick="clearinput()">重置</button>
								</div>
							</form>
						</div>
					</div>
				</div>
			</div>
		{/notempty}
		</div>
	</div>
</div>
<div class="row">
	{volist name="page_statistics" id="statistic"}
	<div class="col-md-{$statistic['colmd']}">
		<div class="box box-success">
			<div class="box-header with-border">
				<h3 class="box-title">{$statistic.message|htmlspecialchars}</h3>

				<div class="box-tools pull-right">
					<span class="label label-default pull-right">{$statistic.label|htmlspecialchars|default="单位"}</span>
				</div>
				<!-- /.box-tools -->
			</div>
			<!-- /.box-header -->
			<div class="box-body">
				{$statistic.number|htmlspecialchars}
			</div>
			<!-- /.box-body -->
		</div>
		<!-- /.box -->
	</div>
	{/volist}
</div>
<div class="row">
	<div class="col-md-12">
		<div class="box nav-tabs-custom" {notempty name="tab_nav" } style="border-top:0" {/notempty}>

			{notempty name="tab_nav"}
			<ul class="nav nav-tabs">
				{volist name="tab_nav['tab_list']" id="tab"}
				<li {eq name="tab_nav.active" value="$key" }class="active" {/eq}> <a
						href="{$tab.url}">{$tab.title|htmlspecialchars}</a> </li>
				{/volist}
			</ul>
			{else /}
			{empty name="top_search"}
			<div class="box-header with-border">
				<h3 class="box-title">{$page_title|default=""|htmlspecialchars}</h3>
			</div>
			{/empty}
			{/notempty}
			<div class="box-body">
				<div class="tab-pane active">
					<div class="pb10">
						<div class="pull-left">
							{if (!empty($top_button))}
							{volist name="top_button" id="button"}
							{$button|raw}
							{/volist}
							{/if}
							{if (!empty($top_statistics))}
							{volist name="top_statistics" id="button"}
							<a href="javascript:void(0);" class="{$button.class}"
								icon="{$button.icon}">{$button.title}:{$button.value}</a>
							{/volist}
							{/if}

						</div>
						{// 搜索框 }
						{notempty name="search"}
						<div class="pull-right search-bar">
							<input type="hidden" name="search_field" id="search-field"
								value="{php}echo input('param.search_field', '') == '' ? $search['field_all'] : input('param.search_field');{/php}">
							<div class="input-group">
								<div class="input-group-btn">
									<button class="btn btn-default" id="search-btn" data-toggle="dropdown" type="button"
										aria-expanded="false">
										{:lang('不限')} <span class="caret"></span>
									</button>
									<ul class="dropdown-menu">
										<li>
											<a tabindex="-1" href="javascript:void(0)" data-field="{$search.field_all}">{:lang('不限')}</a>
										</li>
										{volist name="search.fields" id="field"}
										<li>
											<a tabindex="-1" href="javascript:void(0)" data-field="{$key}">{$field|htmlspecialchars}</a>
										</li>
										{/volist}
									</ul>
								</div>
								<div {$search_button ?='class="input-group"' }>
									<input type="text" style="border:1px #ccc solid;padding-left:5px;" class="form-control"
										value="{:input('param.keyword', '')}" data-url="{$search.url}" id="search-input" name="keyword"
										placeholder="{$search.placeholder}">
									{$search_button ?= '<span class="input-group-btn"><button class="btn btn-default"
											id="search-submit-btn" type="button">'.($search_button === true ? "搜索" :
											$search_button).'</button></span>'}
								</div>

							</div>
						</div>
						{/notempty}
						{notempty name='back_show'}
							<button style="float: right" class="btn btn-default" type="button" onClick="javascript:history.back(-1);return false;"> {:lang('返回')} </button>
						{/notempty}
						<div class="clearfix"></div>
					</div>
					<input type="hidden" id="tablefields" value="{$tablefields}">
					<input type="hidden" id="tablehide_checkbox" value="{$hide_checkbox}">

					<div class="table-responsive">
						<table id="table" class="table table-builder table-hover table-bordered table-striped mb10">
							<thead>
								{if (!$hide_checkbox)}
								<th class="text-center" style="width: 70px;">
									<input class="minimal-red checkboxCtrl "  data-group="ids[]" data-toggle="icheck" type="checkbox">
								</th>
								{/if}
								{volist name="fields" id="field"}
								<th class="{$field['class']|default=''}">{$field.title}
									{// 排序功能}
									{php}
									if (isset($order_columns[$field['name']])): {/php}
									{php}
									$_by = input('param.by') == 'asc' ? 'desc' : 'asc';
									$_param = array_merge(input('get.'), ['by' => $_by, 'order' =>
									$order_columns[$field['name']]]);
									if ($_param) {
									$_get = [];
									foreach ($_param as $key => $value) {
									$_get[] = $key. '=' .$value;
									}
									$_get = '?'.implode('&', $_get);
									}
									{/php}
									<a href="{$Request.baseUrl}{$_get}" data-toggle="tooltip" data-original-title="{:lang('排序')}">
										{php}
										if (input('param.order') == $order_columns[$field['name']]) {
										echo input('param.by') == 'asc' ? '<i class="fa fa-caret-up"></i>' : '<i
											class="fa fa-caret-down"></i>';
										} else {
										echo '<i class="fa fa-sort text-muted"></i>';
										}
										{/php}
									</a>
									{php}endif;{/php}
								</th>
								{/volist}
							</thead>
							<tbody>
								{volist name="row_list" id="row"}
								<tr>
									{if (!$hide_checkbox)}
									<td class="text-center" style="width: 70px;"><input class="ids minimal-red" data-toggle="icheck"
											type="checkbox" name="ids[]" value="{$row['checkid']|default=''}"></td>
									{/if}

									{volist name="fields" id="column"}
									<td class="{$column['class']|default=''}">
										{php}if(is_array($column['type']) || $column['type'] == '' || $column['type'] ==
										'btn' || $column['type'] == 'text'):{/php}
										{$row[$column['name']]|raw}
										{php}else:{/php}
										{$row[$column['name'].'__'.$column['type']]|raw}
										{php}endif;{/php}
									</td>
									{/volist}
								</tr>
								{/volist}

								{empty name="row_list"}
								<tr class="table-empty"> {php}$colspan = count($fields)+1{/php}
									<td class="text-center empty-info" colspan="{$colspan}"><i class="fa fa-database"></i> {:lang('暂无数据')} <br>
									</td>
								</tr>
								{/empty}
							</tbody>
						</table>
					</div>
					<div class="data-table-toolbar">
						<div class="row">
							<div class="col-sm-12"> {// 分页 }
								{notempty name="pages"}
								{$pages|raw}
								{/notempty}
								{notempty name="page_info"}
								<div class="pagination-info pull-right">
									<div>
										<input type="text" class="form-control input-sm go-page" id="go-page" name="page"
											value="{:input('param.page', '1')}">
										<input type="text" class="form-control input-sm nums" id="list-rows" name="list_rows"
											value="{php}echo input('param.list_rows', '') == '' ? $page_info->listRows() : input('param.list_rows');{/php}">
										/ <strong>{$page_info->lastPage()|raw}</strong>  {:lang('页')}， {:lang('共')}
										<strong>{$page_info->total()|raw}</strong> {:lang('条数据')}，{:lang('每页显示数量')}
									</div>
								</div>
								{/notempty}
								{notempty name="bottom_button_select"}
								<div class="bottom-select-all">
									<div>
										{if (!$hide_checkbox)}
										<th class="text-center" style="width: 70px;">
											<input class="minimal-red checkboxCtrl" data-group="ids[]" data-toggle="icheck" type="checkbox">
										</th>
										{/if}
										<span>{:lang('全选')}</span>
									</div>
									<div>


										<select name="" id="" class="select-mian">
											<option value="-1">{:lang('请选择')}</option>
											{volist name="bottom_button_select" id="row"}
											<option value="/admin.php{$action}" action="{$row.ident}">{$row.title}
											</option>
											{/volist}
										</select>

									</div>
									<div>
										<button class="select-btn" id="select-btn">{:lang('确定')}</button>
									</div>
								</div>
								{/notempty}
								<style>
									.bottom-select-all {
										display: flex;
										flex-wrap: nowrap;
										justify-content: space-between;
										align-items: center;
										width: 250px;
										margin-left: 9px;
									}

									.select-mian {
										width: 120px;
										height: 28px;
										border-radius: 2px;
										outline: none;
									}

									.select-btn {
										height: 30px;
										line-height: 28px;
										padding: 0 15px;
										color: #fff;
										background: #409EFF;
										font-size: 12px;
										float: left;
										margin-right: 10px;
										outline: none;
										border: none;
										border-radius: 4px;
									}
								</style>
							</div>
						</div>
					</div>
				</div>
			</div>
		</div>
	</div>
</div>
{/block}
{block name="script"}
<script type="text/javascript" src="https://cdn.datatables.net/1.11.4/js/jquery.dataTables.min.js"></script>
<script type="text/javascript" src="https://cdn.datatables.net/fixedcolumns/4.0.1/js/dataTables.fixedColumns.min.js"></script>
{volist name="js_list" id="vo"}
<script src="{$vo}?v={:config('asset_version')}"></script>
{/volist}
<script>
	$(document).ready(function() {
		$('#table').DataTable({
			scrollY: '1000px',
			scrollX: '100%',
			scrollCollapse: true,
			paging: false,
			info: false,
			searching:false,
			ordering:false,
			fixedColumns: {
				right: 1,
			}
		});
	})
</script>
{/block}